package com.example.demo.config;

import org.elasticsearch.common.unit.TimeValue;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import lombok.Data;

/**
 * @author Eric
 */
@Data
@Component
@ConfigurationProperties("es")
public class EsProperties {

    private String clusterName;

    private String[] transportAddresses;

    private int port = 9300;

    /**
     * 单位为秒
     */
    private int scrollKeepAliveSeconds = 300;

    private int scrollPageSize = 1000;

    public TimeValue getScrollKeepAlive() {
        return TimeValue.timeValueSeconds(scrollKeepAliveSeconds);
    }

}
